#include <iostream>
#include <vector>

using namespace std;

class Solution
{
	string strA[10] = { "","","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz" };
public:
	void Combine(string digits, size_t level, vector<string>& v, string Comstr)
	{
		if (level == digits.size())
		{
			v.push_back(Comstr); 
			return;
		}

		size_t num = digits[level] - '0';
		string str = strA[num];
		for (size_t i = 0; i < str.size(); i++)
		{
			Combine(digits, level + 1, v, Comstr + str[i]);
		}
	}

	vector<string> letterCombinations(string digits)
	{
		vector<string> v;
		if (digits.empty())
		{
			return v;
		}
		Combine(digits, 0, v, "");
		return v;
	}
};

int main()
{
	string a("23");
	Solution z;
	vector<string> l = z.letterCombinations(a);
	for (auto e : l)
	{
		cout << e << " ";
	}
	return 0;
}